#ifndef MYWIDGET_H
#define MYWIDGET_H

#include <QWidget>
#include <QtSql>
#include <QSqlQuery>
namespace Ui {
class MyWidget;
}
class test15_DB : public QThread
{
    Q_OBJECT
public:
    QSqlDatabase  DB; //数据
    QSqlTableModel  *tabModel;  //数据模型
    bool rqlint(QString dbname);

    void creattable(QString tablename);

    void initial_data();

    void select(QString name);

    void deletedata(int counm, QString nametable);

    void sort();
signals:
    void sig_over(int errorinfo);//测试结束标识
    void sig_process(int process);
private:

    void run() override;
};

class MyWidget : public QWidget
{
    Q_OBJECT

public:
    explicit MyWidget(QWidget *parent = nullptr);
    ~MyWidget();

    void initital();


private slots:
    void on_pushButton_3_clicked();

    void on_pushButton_clicked();

    void slot_over(int error);

    void on_pushButton_6_clicked();

    void on_pushButton_2_clicked();

    void on_pushButton_4_clicked();

private:
    Ui::MyWidget *ui;
    test15_DB *my_DB;
    int state;

    void set_enable(bool state);

};

#endif // MYWIDGET_H
